package com.paas.demo.kafka;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSON;
import com.plat.paas.kafka.Message;
import com.plat.paas.kafka.MessageExecutor;

public class MsgExecutor implements MessageExecutor{

	private Logger logger = LoggerFactory.getLogger(getClass());
	
    @Override
    public void execute(Message message) throws Exception {
    	
    	try {
            switch (message.getTopic()) {
			case "test-topic":
				logger.info("Topic " + message.getTopic()+ ", 获取到待消费的信息："+JSON.toJSONString(message));
				break;
			default:
				logger.info("default topic msg = "+ JSON.toJSONString(message));
				break;
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
        
    }
    
    
}

